<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";

%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>教师个人信息</title>
<script src="<%=basePath%>/js/jquery-3.2.1.min.js"></script>
<script src="<%=basePath%>/js/vue.min.js"></script>
  <link rel="stylesheet" href="<%=basePath%>/layui/css/layui.css" media="all">
<script src="<%=basePath%>/layui/css/layui.css" charset="utf-8"></script>
</head>
<body>
	<div class="site-text site-block" style="margin-top:50px">
	
      <form id="aform" name="aform" class="layui-form">
        <div class="layui-form-item">
          <label class="layui-form-label">工号</label>
          <div class="layui-input-block">
            <input id="sno" value="${sessionScope.teacher.tno}" disabled="disabled" type="text" name="tno" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">姓名</label>
          <div class="layui-input-block">
            <input id="sname" value="${sessionScope.teacher.tname}" disabled="disabled" type="text"  name="tname" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">性别</label>
          <div class="layui-input-block">
            <input id="sex" value="${sessionScope.teacher.sex}" disabled="disabled" type="text" name="sex" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">院系</label>
          <div class="layui-input-block">
            <input id="sDepartment" value="${sessionScope.teacher.tDepartment}" disabled="disabled" type="tDepartment" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">学科</label>
          <div class="layui-input-block">
            <input id="tObject" value="${sessionScope.teacher.tObject}" disabled="disabled" type="text" name="tObject" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">学历</label>
          <div class="layui-input-block">
            <input id="tDegree" value="${sessionScope.teacher.tDegree}" disabled="disabled" type="text" name="tDegree" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">职称</label>
          <div class="layui-input-block">
            <input id="tJobs" value="${sessionScope.teacher.tJobs}"  type="text" name="tJobs" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">研究方向</label>
          <div class="layui-input-block">
            <input id="cDirection" value="${sessionScope.teacher.cDirection}"  type="text" name="cDirection" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">邮箱</label>
          <div class="layui-input-block">
            <input id="email" value="${sessionScope.teacher.email}" type="text" name="email" required="" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
          <div class="layui-form-item">
          <label class="layui-form-label">办公室</label>
          <div class="layui-input-block">
            <input id="sClass" value="${sessionScope.teacher.tAddress}"  type="text" name="tAddress" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        <div class="layui-form-item">
          <label class="layui-form-label">电话</label>
          <div class="layui-input-block">
            <input id="sPhone" value="${sessionScope.teacher.tPhone}" type="text" name="tPhone" required="" lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" style="width:200px">
          </div>
        </div>
        

        <div class="layui-form-item">
          <label class="layui-form-label">原密码</label>
          <div class="layui-input-inline">
            <input id="oldPsw" type="password" name="oldPsw" required="" lay-verify="required" lay-vertype="tips" placeholder="请输入原密码" autocomplete="off" class="layui-input">
          </div>
        </div>
        
         <div class="layui-form-item">
          <label class="layui-form-label">新密码</label>
          <div class="layui-input-inline">
            <input id="psw1" onchange="checkpwd()" type="password" name="psw1" required="" lay-verify="required" lay-vertype="tips" placeholder="请输入新密码" autocomplete="off" class="layui-input">
          </div>
        </div>
        
         <div class="layui-form-item">
          <label class="layui-form-label">确认密码</label>
          <div class="layui-input-inline">
            <input id="psw2" onchange="checkpwd()" type="password" name="psw2" required="" lay-verify="required" lay-vertype="tips" placeholder="请再次输入新密码" autocomplete="off" class="layui-input">
          	<div id="msg" style="color:red;"></div>
          </div>
        </div>
        
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button id="btn" class="layui-btn btn-submit" lay-filter="reg" lay-submit="">修改</button>
          </div>
        </div>
      </form>
    </div>
</body>
<script type="text/javascript">
	function checkpwd(){
		var p1=window.document.aform.psw1.value;//获取密码框的值
		var p2=window.document.aform.psw2.value;//获取重新输入的密码值
		
		if(p1!=p2){//判断两次输入的值是否一致，不一致则显示错误信息
			window.document.getElementById("msg").innerHTML="两次输入密码不一致，请重新输入";//在div显示错误信息
		}else{
			window.document.getElementById("msg").innerHTML="";
	}
}

$('#btn').click(function(){
	var param = {};
	param.tDepartment = window.document.getElementById("tDepartment").value;
	param.tObject = window.document.getElementById("tObject").value;
	param.tDegree = window.document.getElementById("tDegree").value;
	param.tJobs = window.document.getElementById("tJobs").value;
	param.cDirection = window.document.getElementById("cDirection").value;
	param.email = window.document.getElementById("email").value;
	param.tAddress = window.document.getElementById("tAddress").value;
	param.tPhone = window.document.getElementById("tPhone").value;
	param.oldPsw = window.document.getElementById("oldPsw").value;
	param.psw1 = window.document.getElementById("psw1").value;
	param.psw2 = window.document.getElementById("psw2").value;
	
	
	$.ajax({
        cache:true,
        type:"POST",
        url:"/bysjxksys/teacher/editTeacher_info",//这是我在后台接受数据的文件名
        data:param
        })
    });
	
</script>

</html>



